package com.hzdesk.media.matvector.koreabatch.client.my_paperless.utils;

import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.view.View;

/**
 * Created by Administrator on 2018/8/7.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 *
 * @desc 隐藏虚拟按键
 */

public class VirtualButtonsUtils {

    /**
     * @desc 隐藏虚拟按键
     * */
    public static void hideNavKey(Context context) {

        if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) {
            View v = ((Activity) context).getWindow().getDecorView();
            v.setSystemUiVisibility(View.GONE);
        } else if (Build.VERSION.SDK_INT >= 19) {
            //for new api versions.
            View decorView = ((Activity) context).getWindow().getDecorView();
            int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
            decorView.setSystemUiVisibility(uiOptions);
        }
    }
    /**
     * @desc 显示虚拟按键
     * */
    public static void showNavKey(Context context, int systemUiVisibility) {//getWindow().getDecorView().getSystemUiVisibility() 传入0也可以
        ((Activity) context).getWindow().getDecorView().setSystemUiVisibility(systemUiVisibility);

    }
}
